using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;

namespace Dogfight2008.Common.Tests
{
  [TestFixture]
  public class Box2dCollisionDetectorFixture
  {
    [Test]
    public void Construct()
    {
      Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
    }

    [Test]
    public void SingleBoxMeansNoCollisions()
    {
      Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
      d.AddBox(new Box2d(0,0, 0, 10, 0, 10, 0), 0);
      List<Collision<int>> colls = d.Detect();
      CollectionAssert.IsEmpty(colls);
    }

    [Test]
    public void TwoColliding()
    {
      Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
      d.AddBox(new Box2d(0, 0, -1, 1, -1, 1, 0), 1);
      d.AddBox(new Box2d(2, 2, -10, 10, -10, 10, 0), 2);
      List<Collision<int>> colls = d.Detect();
      List<Collision<int>> exp = new List<Collision<int>>();
      exp.Add(new Collision<int>(1, 2));
      CollectionAssert.AreEqual(exp, colls);
    }

    [Test]
    public void TwoNotColliding()
    {
      Box2dCollisionDetector<int> d = new Box2dCollisionDetector<int>();
      d.AddBox(new Box2d(0, 0, -1, 1, -1, 1, 0), 1);
      d.AddBox(new Box2d(200, 2, -10, 10, -10, 10, 0), 2);
      List<Collision<int>> colls = d.Detect();
      List<Collision<int>> exp = new List<Collision<int>>();
      CollectionAssert.AreEqual(exp, colls);
    }
  }
}
